package com.tom.chain_of_responsibility.v2;

import com.tom.chain_of_responsibility.model.req.UserSearchReq;

/**
 * 抽象的请求处理器
 *
 * @author zx
 * @date 2024-10-10 20:42
 */
public abstract class IRequestHandler {
    IRequestHandler next;

    public void setNext(IRequestHandler next){
        this.next = next;
    }

    public boolean hasNext(){
        return this.next !=null;
    }

    public Boolean handleRequest(UserSearchReq userSearchReq) {
        if (hasNext()) {
            return next.handleRequest(userSearchReq);
        }
        return null;
    }
}
